package com.bootdo.app.common.utils;


import lombok.Getter;
import lombok.Setter;

import java.io.Serializable;
import java.util.LinkedHashMap;
import java.util.Map;

/**
  * @auther: Along
  * @description: 查询类
  * @Date: created in 2020/4/5 0:25
  */
@Getter
@Setter
public class Query extends LinkedHashMap<String,Object> implements Serializable{
    public static final long serialVersionUID = 1L;

    // 当前页码
    private int page = 1;
    // 每页条数
    private int limit = 10;

    public Query(Map<String,Object> params){
        if(params != null){
            this.putAll(params);
            Object page = params.get("page");
            if(null != page){
                this.page = Integer.parseInt(String.valueOf(page));
                this.remove("page");
            }
            Object limit = params.get("limit");
            if(null != limit){
                this.limit = Integer.parseInt(String.valueOf(limit));
                this.remove("limit");
            }
        }
    }



}
